/*
 * @Description
 * @Date: 2024-06-04 17:03:12
 * @LastEditTime: 2024-09-10 14:59:12
 */
import { uploadAvatar } from '@/api/system/user/profile'
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'

// 表单校验
export const rules = reactive({
  nickname: [required],
  avator: [required],
})

// CrudSchema https://doc.iocoder.cn/vue3/crud-schema/
const crudSchemas = reactive<CrudSchema[]>([


  {
    label: '检察长',
    field: 'nickname',
    isSearch: true,
  },
  {
    label: '部门',
    field: 'deptName',
    isSearch: false,
  },
  {
    label: '头像',
    field: 'avatar',
    form:{
      component:"UploadImg"
    },
    isSearch: false,
    table:{
      width:300
    }
  },
  {
    label: '处理案件类型',
    field: 'caseType',
    isSearch: false,
    dictType: DICT_TYPE.DEALCASE_TYPE,
    form: {
      component: 'Select',
      componentProps: {
        multiple: true,
      }
    }
  },
  {
    label: '简介',
    field: 'introduction',
    isSearch: false,
    form: {
      component: 'Input',
      componentProps: {
        type: 'textarea',
      }
    }
  },
  {
    label: '工作成就',
    field: 'attainment',
    isSearch: false,
    form: {
      component: 'Input',
      componentProps: {
        type: 'textarea',
      }
    }
  },
  {
    label: '接访案例',
    field: 'examples',
    isSearch: false,
    form: {
      component: 'Input',
      componentProps: {
        type: 'textarea',
      }
    }
  },
  {
    label: '接访承诺',
    field: 'promise',
    isSearch: false,
    form: {
      component: 'Input',
      componentProps: {
        type: 'textarea',
      }
    }
  },
  {
    label: '创建人',
    field: 'post',
    isSearch: false,
    isForm: false,
  },
  {
    label: '创建时间',
    field: 'createTime',
    isSearch: false,
    isForm: false,
    formatter: dateFormatter,
    search: {
      component: 'DatePicker',
      componentProps: {
        valueFormat: 'YYYY-MM-DD HH:mm:ss',
        type: 'daterange',
        defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
      }
    },
  },
 
  {
    label: '操作',
    field: 'action',
    isForm: false
  }
])
export const { allSchemas } = useCrudSchemas(crudSchemas)
